package me.send.produce.data.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import me.send.data.service.service.ConfigurationService;
import me.send.data.service.service.TreeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "configuration")
public class ConfigurationController {

	@Autowired
	private ConfigurationService configurationService;

	@Autowired
	private TreeService treeService;

	// 展示界面的操作 2015年7月8日15:21:54
	// 查询分页数据
	@RequestMapping(value = "configuration/list")
	public ModelAndView order_list(HttpServletRequest request) {
		// 增加一个连接 2015年6月19日16:57:02
		// 如果这个连接 和 树里面的链接是一样的 那就替换一下
		ModelAndView modelAndView = new ModelAndView(
				"/stage/configuration/configuration_list");
		// session.setAttribute("LoadTree", treeService.main_tree(0, request,
		// "broker/broker/list.htm"));
		modelAndView.addObject("LoadTree",
				treeService.main_tree(0, request, "configuration/configuration/list"));
		modelAndView.addObject("module", "基础数据");
		return modelAndView;
	}

	@RequestMapping(value = "list/all")
	@ResponseBody
	public Map<String, Object> list_all() {
		return configurationService.list_all();
	}

}
